import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import i18n from '@/lang'

import '@/icons' // icon
import '@/permission' // permission control
// 引入自己注册的组件
import pluginComponent from '@/components/index.js'
// 引入自己注册的原型方法
import chartPlugin from '@/utils/chart'
Vue.use(chartPlugin)
import * as diects from '@/directives/index.js'
import myMixin from '@/mixin'
Vue.mixin(myMixin)
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 英文element ui 组件库
Vue.use(ElementUI, {
  i18n: (k, v) => i18n.t(k, v)
})
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
// 使用自己的插件
Vue.use(pluginComponent)

// 挂载全局
// Vue.directive('imgerr', diects.imgerr)
Object.keys(diects).forEach(key => {
  Vue.directive(key, diects[key])
})
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
